function RegexUtil () {

    const mrz2regx = new RegExp('(((?!.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[<]))|((?!.*[a-z])(?!.*[<])(?=.*[A-Z])(?=.*[0-9])))(.{44})','g')

    this.isLetter = function (char) {
        return /^[a-zA-Z]$/.test(char)
    }

    this.isChinese = function (char){
        return /^[\u4E00-\u9FA5\uF900-\uFA2D]+$/.test(char);
    }

    this.isMRZ2 = function (str) {
        return mrz2regx.test(str)
    }

    this.matchMRZ1 = function (str, countryCode){
        console.log(countryCode)
        if(countryCode){
            //根据通用规则匹配mrz码
            var reg = new RegExp('P[a-zA-Z<]{1}('+countryCode+')[\\w<]{38}<')
            //var list = str.match(/P[a-zA-Z<]{1}(${countryCode})[\w<]{38}</)
            var list = str.match(reg)
            if(list && list.length>0){
                return list
            }
        }
        //普通护照
        var list = str.match(/PO[a-zA-Z]{3}[\w<]{38}</)
        if(list && list.length>0){
            return list
        }
        //因公护照
        list = str.match(/PS[a-zA-Z]{3}[\w<]{38}</)
        if(list && list.length>0){
            return list
        }
        //香港护照
        list = str.match(/P<CHN[\w<]{38}</)
        if(list && list.length>0){
            return list
        }
        return list
    }

    this.matchMRZ2 = function (str) {
        return str.match(/\w{10}[a-zA-Z]{3}\d{6}\w{1}[MF]{1}\d{6}\w{1}[\w<]{14}\w{2}/)
    }

}

export default new RegexUtil()
